//package com.lanou3g.ptp.api.service.impl;
//
//import com.alibaba.dubbo.config.annotation.Reference;
//import com.alibaba.dubbo.config.annotation.Service;
//import com.github.pagehelper.PageInfo;
//import com.lanou3g.ptp.api.pojo.ClassVO;
//import com.lanou3g.ptp.api.service.ApiClazzService;
//import com.lanou3g.ptp.entity.*;
//import com.lanou3g.ptp.organize.service.ClazzService;
//import com.lanou3g.ptp.organize.service.CollegeService;
//import com.lanou3g.ptp.organize.service.MajorService;
//import com.lanou3g.ptp.student.service.StudentService;
//import com.lanou3g.ptp.teacher.service.TeacherService;
//import com.lanou3g.ptp.user.service.UserService;
//import com.lanou3g.ptp.utils.PtpResult;
//import com.lanou3g.ptp.utils.PtpResultUtils;
//
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//@Service
//public class ApiClazzServiceImpl implements ApiClazzService {
//    @Reference
//    private ClazzService clazzService;
//    @Reference
//    private CollegeService collegeService;
//    @Reference
//    private MajorService majorService;
//    @Reference
//    private StudentService studentService;
//    @Reference
//    private TeacherService teacherService;
//    @Reference
//    private UserService userService;
//
//    @Override
//    public List<ClassVO> findStuSubmitTasks(Integer page, Integer size) {
//        PageInfo<Clazz> clazzes = clazzService.findByPage(page, size);
//        List<ClassVO> classVOS = new ArrayList<>();
//        for (Clazz clazz : clazzes.getList()) {
//            Major major = majorService.findById(clazz.getMajorId());
//            College college = collegeService.findById(major.getCollegeId());
//            SsoTeacher teacher = teacherService.findById(clazz.getLeaderId());
//            teacher.setUser(userService.userById(teacher.getId()));
//            Student student = studentService.findById(clazz.getMonitorId());
//            student.setUser(userService.userById(student.getId()));
//            Long count = studentService.findClazzId(clazz.getId());
//
//            ClassVO classVO = new ClassVO(clazz);
//            classVO.setCollegeName(college.getName());
//            classVO.setMajorName(major.getName());
//            classVO.setLeaderName(teacher.getUser().getName());
//            classVO.setMonitorName(student.getUser().getName());
//            classVO.setCount(count);
//
//            classVOS.add(classVO);
//        }
//        return classVOS;
//    }
//
//    @Override
//    public PtpResult findByName(String name) {
//        Clazz clazz = clazzService.findByName(name);
//        Map<String, Object> result = new HashMap<>();
//        result.put("clazz", clazz);
//        Major major = majorService.findById(clazz.getMajorId());
//        result.put("majorName", major.getName());
//        Long count = studentService.findClazzId(clazz.getId());
//        result.put("count", count);
//        return PtpResultUtils.ok(result);
//    }
//}
